package com.yuchao.base.xyc004.factory.abstractfactory;

import com.yuchao.base.xyc004.factory.simplefactory.ComputerService;

/**
 * Created by xingyuchao on 2017-06-17.
 * 同样定义工厂标准
 */
public abstract class ComputerFactory {

    public abstract ComputerService getComputer();

    public ComputerService getComputer(String computerName){
        if("Asus".equals(computerName)){
            return new AsusFactory().getComputer();
        }else if("Dell".equals(computerName)){
            return new DellFactory().getComputer();
        }else if("ThinkPad".equals(computerName)){
            return new ThinkPadFactory().getComputer();
        }else{
            return null;
        }
    }
}